fix: Fix version detection in sphinx-multiversion documentation builds#618
Merged
laughingman7743 merged 2 commits intomasterfrom Oct 18, 2025
Merged
Conversation
This commit fixes the issue where documentation versions were displayed incorrectly in the built HTML files. ## Problem When sphinx-multiversion builds documentation for different tags and branches, the version string was not correctly detected: - v3.18.0 showed "vNone" - v3.19.0 showed dev version instead of "v3.19.0" - v3.5.0 showed "v3.4.0" instead of "v3.5.0" ## Solution Added a `config-inited` event handler that uses sphinx-multiversion's `smv_current_version` config value to set the correct version: - For version tags (like "v3.19.0"), extract the version directly from the tag name - For branches (like "master"), fall back to git commands to get dev version - Removed `uv build` from Makefile since version is now set dynamically ## Testing Local build with `make docs` now correctly shows: - v3.18.0 → "v3.18.0" ✓ - v3.19.0 → "v3.19.0" ✓ - v3.5.0 → "v3.5.0" ✓ - master → correct dev version ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove 'docs' from ruff exclude list in pyproject.toml - Apply ruff formatting to docs/conf.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When sphinx-multiversion builds documentation for different tags and branches, the version string was not correctly detected:
Solution
Added a
config-initedevent handler that uses sphinx-multiversion'ssmv_current_versionconfig value to set the correct version:uv buildfrom Makefile since version is now set dynamicallyChanges
config_inited()handler andsetup()function for dynamic version detectionuv buildstepTesting
Local build with
make docsnow correctly shows:Related Issues
Fixes version display issues reported in:
🤖 Generated with Claude Code